<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../vue/vue.js"></script>
</head>
<body>

<div id="app">
    <user v-slot:default="slotprops">
        <p>username:{{slotprops.username}}</p>
        <p>age:{{slotprops.age}}</p>
    </user>

    <hr>
    <!--
        es6  结构赋值
        slotprops  {}
        let {username,age} = {}
    -->
    <user v-slot:default="{username,age}">
        <p>username:{{username}}</p>
        <p>age:{{age}}</p>
    </user>

</div>

<script>

    let user = {
        template: `
          <div>
            <slot :username="username" :age="age"></slot>
          </div>
        `,
        data() {
            return {
                username: 'jack',
                age: 30
            }
        }

    }

    let vm = new Vue({
        el: '#app',
        data: {},
        methods: {},
        components: {
            user
        }
    })
</script>

</body>
</html>
